<template>
  <el-dialog
    :visible.sync="dialogVisible"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    append-to-body
    title="微页面选择"
    width="700px">
    <div class="toolbar-search">
      <div class="pageName">
        页面名称:
        <el-input v-model="params.page_name"></el-input>
      </div>
      <div class="cityAddr">
        页面类型:
        <el-select v-model="params.page_type" clearable placeholder="请选择">
          <el-option label="微页面" value="0"></el-option>
          <el-option label="平台" value="1"></el-option>
          <el-option label="城市" value="2"></el-option>
        </el-select>
      </div>
      <el-button type="primary" size="mini" @click="GET_PageList">查询</el-button>
    </div>
    <el-table
      :data="tableData.data"
      highlight-current-row
      @current-change="handleCurrentChange"
      :loading="loading">
      <el-table-column
        width="32">
        <template slot-scope="scope">
          <el-radio v-model="currentPage" :label="scope.row.page_id"></el-radio>
        </template>
      </el-table-column>
      <el-table-column label="页面名称" prop="page_name" min-width="120"></el-table-column>
      <el-table-column prop="page_type" label="页面类型" min-width="200"/>
      <el-table-column prop="state" label="页面状态" min-width="200">
        <template slot-scope="scope">
          {{scope.row.state===1?'已保存':scope.row.state===2?'已上架':scope.row.state===3?'已下架':''}}
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      v-if="tableData"
      @size-change="handlePageSizeChange"
      @current-change="handlePageCurrentChange"
      :current-page="tableData.page_no"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="tableData.page_size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="tableData.data_total">
    </el-pagination>
    <div slot="footer" class="dialog-footer">
      <el-button size="small" @click="dialogVisible = false">取消</el-button>
      <el-button size="small" type="primary" @click="handleConfirm">确定</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import mixin from './mixin'

  export default {
    name: 'EnPageDialog',
    mixins: [mixin]
  }
</script>

<style type="text/scss" lang="scss" scoped>
  @import "./styles";
  .el-pagination {
    margin-top: 10px;
    text-align: right;
  }
  .toolbar-search {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-around;
    margin: 10px 0;
    .pageName .el-input.el-input--small{
      width: 74%!important;
    }
  }
</style>
